package session

import (
	"net/http"
	"server/framework/web/context"
)

type Session interface {
	Get(ctx *context.Context, id string) (interface{}, error)
	Set(ctx *context.Context, id string, data interface{}) error
	ID() string
}

// Store 管理session
type Store interface {
	Generate(ctx *context.Context, id string) (Session, error)
	Get(ctx *context.Context, id string) (Session, error)
	Remove(ctx *context.Context, id string) error
	Refresh(ctx *context.Context, id string) error
}

// Propagator 将session注入cookie中
type Propagator interface {
	Extract(r *http.Request) (string, error)
	Inject(w http.ResponseWriter, id string) error
	Delete(w http.ResponseWriter) error
}
